package ai.connectfour.entities;

public class Action implements Comparable<Action> {
	private int col;
	private Player player;
	private int fieldValue; 

	public int getFieldValue() {
		return fieldValue;
	}

	public void setPlayer(Player player) {
		this.player = player;
	}

	public Action(int col, Player player) {
		this.col = col;
		this.player = player;
	}

	public Action(int col, Player player, int fieldValue) {
		this.col = col;
		this.player = player;
		this.fieldValue = fieldValue;
	}
	
	public Player getPlayer() {
		return player;
	}
	
	public int getCol() {
		return col;
	}
	
	public void setFieldValue(int fieldValue) {
		this.fieldValue = fieldValue;
	}
	
	@Override
	public boolean equals(Object obj){
		return this.equals((Action) obj);
	}
	
	public boolean equals(Action action){
		if(action.col == this.col){
			return true;
		}else{
			return false;
		}
	}

	@Override
	public int compareTo(Action action) {
		if(this.fieldValue < action.fieldValue){
			return 1;
		}else if(this.fieldValue > action.fieldValue){
			return -1;
		}
		return 0;
	}
	
	public String toString()
	{
		return  "Player: " + player + " Col: " + col + " FieldValue: " + fieldValue;	
	}
}
